﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _30堆栈结构
{
    class Program
    {
        static void Main(string[] args)
        {
            People p = new People();
            p.Age = 10;
            People p1 = new People();
            p1.Age = 20;
            People p2 = new People();
            p2.Age = 30;

            //在c#当中针对引用类型的内存分配，会在引用类
            //型实际占用的内存大小上在增加8个字节进行管理
            //Console.WriteLine(System.Runtime.InteropServices.Marshal.SizeOf(p2));
            
            p1 = null;
            Console.ReadKey();
        }
    }
    class People
    {
        public int _age;
        public int Age
        {
            set
            {
                _age = value;
            }  
            get
            {
                return _age;
            }            
        }
    }
}
